home *** CD-ROM | disk | FTP | other *** search
- % $Id: header.ps,v 1.2 1995/11/21 13:51:51 zeller Exp $
- % Header for NORA PostScript Box output
-
- % Copyright (C) 1995 Technische Universitaet Braunschweig, Germany.
- % Written by Christian Lindig (lindig@ips.cs.tu-bs.de).
- %
- % This file is part of the DDD Library.
- %
- % The DDD Library is free software; you can redistribute it and/or
- % modify it under the terms of the GNU Library General Public
- % License as published by the Free Software Foundation; either
- % version 2 of the License, or (at your option) any later version.
- %
- % The DDD Library is distributed in the hope that it will be useful,
- % but WITHOUT ANY WARRANTY; without even the implied warranty of
- % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- % See the GNU Library General Public License for more details.
- %
- % You should have received a copy of the GNU Library General Public
- % License along with the DDD Library -- see the file COPYING.LIB.
- % If not, write to the Free Software Foundation, Inc.,
- % 675 Mass Ave, Cambridge, MA 02139, USA.
- %
- % DDD is the data display debugger.
- % For details, see the DDD World-Wide-Web page,
- % `http://www.cs.tu-bs.de/softech/ddd/',
- % or send a mail to the DDD developers at `ddd@ips.cs.tu-bs.de'.
-
- %
- % make all definitions local to the noradict dictionary
- %
-
- /noradict 25 dict def
-
- noradict begin % make dict active
-
- %
- % global variables
- %
-
- /fontSize+ 12 def
- /font+ /Courier def
-
- %
- % some small utilities
- %
-
- /cm { 28.34646 mul } bind def
-
- % isolatin1*
- % reencode a font to ISO Latin 1 encoding
- %
- % newfont table oldfont isolatin1*
-
- /isolatin1* {
- findfont
- dup maxlength dict begin
- {
- 1 index /FID ne { def } { pop pop } ifelse
- } forall
- /Encoding exch def
- dup /FontName exch def
- currentdict end definefont pop
- } bind def
-
- %
- % define the ISO Latin 1 encoding of a font ..
- %
-
- /isotable[
- /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef
- /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef
- /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef
- /.notdef/.notdef/.notdef/.notdef/.notdef/space/exclam/quotedbl/numbersign
- /dollar/percent/ampersand/quoteright/parenleft/parenright/asterisk/plus/comma
- /hyphen/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon
- /semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O/P/Q/R/S
- /T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/asciicircum/underscore
- /quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/braceleft/bar
- /braceright/asciitilde/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef
- /.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef
- /.notdef/dotlessi/grave/acute/circumflex/tilde/macron/breve/dotaccent/dieresis
- /.notdef/ring/cedilla/.notdef/hungarumlaut/ogonek/caron/.notdef/exclamdown/cent
- /sterling/currency/yen/brokenbar/section/dieresis/copyright/ordfeminine
- /guilsinglleft/logicalnot/hyphen/registered/macron/degree/plusminus/twosuperior
- /threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior
- /ordmasculine/guilsinglright/onequarter/onehalf/threequarters/questiondown
- /Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE/Ccedilla/Egrave/Eacute
- /Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex/Idieresis/Eth/Ntilde/Ograve
- /Oacute/Ocircumflex/Otilde/Odieresis/multiply/Oslash/Ugrave/Uacute/Ucircumflex
- /Udieresis/Yacute/Thorn/germandbls/agrave/aacute/acircumflex/atilde/adieresis
- /aring/ae/ccedilla/egrave/eacute/ecircumflex/edieresis/igrave/iacute
- /icircumflex/idieresis/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis
- /divide/oslash/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis
- ] def
-
- %
- % ycorrect*
- % the reference point of a string ist NOT its lower left corner but
- % its baseline. Therefor the y coordinate must be corrected. The
- % correction for the current font is returned.
- % ycorrect* y
- %
-
- /ycorrect* {
- currentfont /FontBBox get
- aload pop pop pop
- currentfont /FontMatrix get dtransform
- exch pop
- } def
-
- %
- % text*
- % print out a string and make sure not to require more space than
- % specified.
- % font xsize ysize xorigin yorigin (string) text*
-
- /text* {
-
- /string+ exch def % set up some variables ..
- moveto % move to (xorigin,yorigin)
- /ysize+ exch def
- /xsize+ exch def
- /thefont+ exch def
-
- % right font allready selected ?
-
- thefont+ font+ ne
- ysize+ fontSize+ ne
- or {
- % set up the right font - reencode it
-
- /Symbol thefont+ eq
- {
- thefont+ findfont
- }{
-
- /isofont+ isotable thefont+ isolatin1*
- /isofont+ findfont
- }ifelse
-
- [ysize+ 0 0 ysize+ neg 0 0] makefont
- setfont
-
- /font+ thefont+ def
- /fontSize+ ysize+ def
- } if
-
- % correct current point
-
- 0 ycorrect* neg rmoveto
-
- % string too long ? scale it down ...
- % the actual font is scaled. There is a good chance,
- % that this will not happen too often when the font is not
- % changed during the calls of text*
-
- xsize+ string+ stringwidth pop div dup dup
- 1 lt {
-
- 0 0 1 0 0 6 array astore currentfont exch
- makefont setfont
- pop
- }{
- %
- % string too short ... scale it up
- %
-
- 1.05 gt {
- 0 0 1 0 0 6 array astore currentfont exch
- makefont setfont
- }{
- pop
-
- } ifelse
- } ifelse
-
- string+ show
-
- } bind def
-
-
-
- %
- % arrowline*
- % draw a line of given width with an arrow at its end
- % len gives the height of the triangle forming the head of the arrow
- % and angle the angle at its top
- %
- % angle len x1 y1 x2 y2 linewidth arrowline*
- %
-
- /arrowline* {
- setlinewidth % angle len x1 y1 x2 y2
- /y2 exch def
- /x2 exch def
- /y1 exch def
- /x1 exch def
- /len+ exch def % height of triangle
-
- /alpha+
- y2 y1 sub % define alpha+
- x2 x1 sub
- atan
- def
-
- /base+ % define half of baseline
- exch
- 2 div dup % angle angle
- sin exch cos % sin(angle) cos(angle)
- div % tan(angle)
- len+
- mul % half of baseline
- def
-
- newpath % draw the line
- x1 y1 moveto
- x2 len+ alpha+ cos mul sub % shorten the line to the end
- y2 len+ alpha+ sin mul sub % of the triangle
- lineto
- stroke
-
- gsave % set the origin to the head of
- 0 setlinewidth % the arrow and rotate the system
- x2 y2
- translate % origin now at x2 y2
-
- alpha+ 90 sub rotate % rotate the system
-
- newpath % draw a triangle
- 0 0 moveto
- base+ len+ neg rlineto
- base+ 2 mul neg 0 rlineto
- closepath
- fill
-
- grestore
- } bind def
-
- %
- % line*
- % draw a line of given width from (x1,y1) to (x2,y2)
- % x1 y1 x2 y2 width line*
- %
-
- /line* {
- setlinewidth % x1 y1 x2 y2
- newpath
- 4 2 roll % x2 y2 x1 y1
- moveto % x2 y2
- lineto
- stroke
- } bind def
-
- %
- % clean*
- % fill a box given by four points with white colour ..
- % x1 y1 x2 y2 x3 y3 x4 y4 clean*
- %
-
- /clean* {
- gsave
- 1 setgray
- 0 setlinewidth
- newpath
- moveto lineto lineto lineto
- closepath
- fill
- grestore
- } bind def
-
- %
- % box*
- % fill a box given by four points
- % x1 y1 x2 y2 x3 y3 x4 y4 box*
- %
-
- /box* {
- 0 setlinewidth
- newpath
- moveto lineto lineto lineto
- closepath
- fill
- } bind def
-
- %
- % arc*
- % draw an ellipse with center (cx,cy), diameter dx dy, starting at start
- % and ending at end.
- % start end dx dy cx cy width ARC*
- %
-
- /arc* {
- gsave
- setlinewidth
- translate
- newpath
- dup 3 1 roll % start end dy dx dy
- div 1 scale % dy dx/dy 1 scale => start end dy
-
- 0 exch 0 exch % start end 0 0 dy
- 5 -2 roll % 0 0 dy start end
-
- dup
- 0 eq { % replace 0 by 360
- pop
- 360
- } if
- arc
- stroke
- grestore
- } bind def
-
-
- %
- % set up the right font to the right size
- %
-
- /isofont+ isotable font+ isolatin1* % reencode font+
- % and make it the current font
- /isofont+ findfont
- [fontSize+ 0 0 fontSize+ neg 0 0] makefont
- setfont
-
- %%EndProlog
-